local zhihengs = fk.CreateSkill {
  name = "zhihengs",
  tags={Skill.Compulsory}
}

zhihengs:addEffect(fk.DamageCaused, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self) and data.card and not data.chain then
      local room = player.room
      local useEvent = room.logic:getCurrentEvent():findParent(GameEvent.UseCard)
      if useEvent then
        local dat = useEvent.data
        if table.contains(dat.tos, data.to) then
          local events = room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
            local use = e.data
            return use.responseToEvent and use.responseToEvent.from == player and use.from == data.to
          end, Player.HistoryTurn)
          if #events > 0 then return true end
          events = room.logic:getEventsOfScope(GameEvent.RespondCard, 1, function(e)
            local response = e.data
            return response.responseToEvent and response.responseToEvent.from == player 
              and response.from == data.to
          end, Player.HistoryTurn)
          if #events > 0 then return true end
        end
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    data.damage = data.damage + 1
  end,
})

return zhihengs